using System; 
using System.Text; 
using System.Data;
using System.Data.SqlClient;
using System.Data.Common;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration; 
using System.Xml; 
using System.Xml.Serialization;
using SubSonic; 
using SubSonic.Utilities;
namespace Medianamik.Core.DAL.SubSonicDAL{
    /// <summary>
    /// Strongly-typed collection for the HierarchicalRuleFull class.
    /// </summary>
    [Serializable]
    public partial class HierarchicalRuleFullCollection : ReadOnlyList<HierarchicalRuleFull, HierarchicalRuleFullCollection>
    {        
        public HierarchicalRuleFullCollection() {}
    }
    /// <summary>
    /// This is  Read-only wrapper class for the vw_medianamik_HierarchicalRuleFull view.
    /// </summary>
    [Serializable]
    public partial class HierarchicalRuleFull : ReadOnlyRecord<HierarchicalRuleFull>, IReadOnlyRecord
    {
    
	    #region Default Settings
	    protected static void SetSQLProps() 
	    {
		    GetTableSchema();
	    }
	    #endregion
        #region Schema Accessor
	    public static TableSchema.Table Schema
        {
            get
            {
                if (BaseSchema == null)
                {
                    SetSQLProps();
                }
                return BaseSchema;
            }
        }
    	
        private static void GetTableSchema() 
        {
            if(!IsSchemaInitialized)
            {
                //Schema declaration
                TableSchema.Table schema = new TableSchema.Table("vw_medianamik_HierarchicalRuleFull", TableType.View, DataService.GetInstance("MedianamikProvider"));
                schema.Columns = new TableSchema.TableColumnCollection();
                schema.SchemaName = @"dbo";
                //columns
                
                TableSchema.TableColumn colvarHierarchicalRuleId = new TableSchema.TableColumn(schema);
                colvarHierarchicalRuleId.ColumnName = "HierarchicalRuleId";
                colvarHierarchicalRuleId.DataType = DbType.Guid;
                colvarHierarchicalRuleId.MaxLength = 0;
                colvarHierarchicalRuleId.AutoIncrement = false;
                colvarHierarchicalRuleId.IsNullable = false;
                colvarHierarchicalRuleId.IsPrimaryKey = false;
                colvarHierarchicalRuleId.IsForeignKey = false;
                colvarHierarchicalRuleId.IsReadOnly = false;
                
                schema.Columns.Add(colvarHierarchicalRuleId);
                
                TableSchema.TableColumn colvarChildTypeId = new TableSchema.TableColumn(schema);
                colvarChildTypeId.ColumnName = "ChildTypeId";
                colvarChildTypeId.DataType = DbType.Guid;
                colvarChildTypeId.MaxLength = 0;
                colvarChildTypeId.AutoIncrement = false;
                colvarChildTypeId.IsNullable = false;
                colvarChildTypeId.IsPrimaryKey = false;
                colvarChildTypeId.IsForeignKey = false;
                colvarChildTypeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarChildTypeId);
                
                TableSchema.TableColumn colvarParentTypeId = new TableSchema.TableColumn(schema);
                colvarParentTypeId.ColumnName = "ParentTypeId";
                colvarParentTypeId.DataType = DbType.Guid;
                colvarParentTypeId.MaxLength = 0;
                colvarParentTypeId.AutoIncrement = false;
                colvarParentTypeId.IsNullable = false;
                colvarParentTypeId.IsPrimaryKey = false;
                colvarParentTypeId.IsForeignKey = false;
                colvarParentTypeId.IsReadOnly = false;
                
                schema.Columns.Add(colvarParentTypeId);
                
                TableSchema.TableColumn colvarChildTypeName = new TableSchema.TableColumn(schema);
                colvarChildTypeName.ColumnName = "ChildTypeName";
                colvarChildTypeName.DataType = DbType.String;
                colvarChildTypeName.MaxLength = 50;
                colvarChildTypeName.AutoIncrement = false;
                colvarChildTypeName.IsNullable = false;
                colvarChildTypeName.IsPrimaryKey = false;
                colvarChildTypeName.IsForeignKey = false;
                colvarChildTypeName.IsReadOnly = false;
                
                schema.Columns.Add(colvarChildTypeName);
                
                TableSchema.TableColumn colvarParentTypeName = new TableSchema.TableColumn(schema);
                colvarParentTypeName.ColumnName = "ParentTypeName";
                colvarParentTypeName.DataType = DbType.String;
                colvarParentTypeName.MaxLength = 50;
                colvarParentTypeName.AutoIncrement = false;
                colvarParentTypeName.IsNullable = true;
                colvarParentTypeName.IsPrimaryKey = false;
                colvarParentTypeName.IsForeignKey = false;
                colvarParentTypeName.IsReadOnly = false;
                
                schema.Columns.Add(colvarParentTypeName);
                
                TableSchema.TableColumn colvarParentTypeCanHaveChilds = new TableSchema.TableColumn(schema);
                colvarParentTypeCanHaveChilds.ColumnName = "ParentTypeCanHaveChilds";
                colvarParentTypeCanHaveChilds.DataType = DbType.Boolean;
                colvarParentTypeCanHaveChilds.MaxLength = 0;
                colvarParentTypeCanHaveChilds.AutoIncrement = false;
                colvarParentTypeCanHaveChilds.IsNullable = true;
                colvarParentTypeCanHaveChilds.IsPrimaryKey = false;
                colvarParentTypeCanHaveChilds.IsForeignKey = false;
                colvarParentTypeCanHaveChilds.IsReadOnly = false;
                
                schema.Columns.Add(colvarParentTypeCanHaveChilds);
                
                TableSchema.TableColumn colvarParentTypeIsGenerated = new TableSchema.TableColumn(schema);
                colvarParentTypeIsGenerated.ColumnName = "ParentTypeIsGenerated";
                colvarParentTypeIsGenerated.DataType = DbType.Boolean;
                colvarParentTypeIsGenerated.MaxLength = 0;
                colvarParentTypeIsGenerated.AutoIncrement = false;
                colvarParentTypeIsGenerated.IsNullable = true;
                colvarParentTypeIsGenerated.IsPrimaryKey = false;
                colvarParentTypeIsGenerated.IsForeignKey = false;
                colvarParentTypeIsGenerated.IsReadOnly = false;
                
                schema.Columns.Add(colvarParentTypeIsGenerated);
                
                TableSchema.TableColumn colvarChildTypeCanHaveChilds = new TableSchema.TableColumn(schema);
                colvarChildTypeCanHaveChilds.ColumnName = "ChildTypeCanHaveChilds";
                colvarChildTypeCanHaveChilds.DataType = DbType.Boolean;
                colvarChildTypeCanHaveChilds.MaxLength = 0;
                colvarChildTypeCanHaveChilds.AutoIncrement = false;
                colvarChildTypeCanHaveChilds.IsNullable = false;
                colvarChildTypeCanHaveChilds.IsPrimaryKey = false;
                colvarChildTypeCanHaveChilds.IsForeignKey = false;
                colvarChildTypeCanHaveChilds.IsReadOnly = false;
                
                schema.Columns.Add(colvarChildTypeCanHaveChilds);
                
                TableSchema.TableColumn colvarChildTypeIsGenerated = new TableSchema.TableColumn(schema);
                colvarChildTypeIsGenerated.ColumnName = "ChildTypeIsGenerated";
                colvarChildTypeIsGenerated.DataType = DbType.Boolean;
                colvarChildTypeIsGenerated.MaxLength = 0;
                colvarChildTypeIsGenerated.AutoIncrement = false;
                colvarChildTypeIsGenerated.IsNullable = false;
                colvarChildTypeIsGenerated.IsPrimaryKey = false;
                colvarChildTypeIsGenerated.IsForeignKey = false;
                colvarChildTypeIsGenerated.IsReadOnly = false;
                
                schema.Columns.Add(colvarChildTypeIsGenerated);
                
                TableSchema.TableColumn colvarParentTypePath = new TableSchema.TableColumn(schema);
                colvarParentTypePath.ColumnName = "ParentTypePath";
                colvarParentTypePath.DataType = DbType.AnsiString;
                colvarParentTypePath.MaxLength = 500;
                colvarParentTypePath.AutoIncrement = false;
                colvarParentTypePath.IsNullable = true;
                colvarParentTypePath.IsPrimaryKey = false;
                colvarParentTypePath.IsForeignKey = false;
                colvarParentTypePath.IsReadOnly = false;
                
                schema.Columns.Add(colvarParentTypePath);
                
                TableSchema.TableColumn colvarParentTypeDepth = new TableSchema.TableColumn(schema);
                colvarParentTypeDepth.ColumnName = "ParentTypeDepth";
                colvarParentTypeDepth.DataType = DbType.Int32;
                colvarParentTypeDepth.MaxLength = 0;
                colvarParentTypeDepth.AutoIncrement = false;
                colvarParentTypeDepth.IsNullable = true;
                colvarParentTypeDepth.IsPrimaryKey = false;
                colvarParentTypeDepth.IsForeignKey = false;
                colvarParentTypeDepth.IsReadOnly = false;
                
                schema.Columns.Add(colvarParentTypeDepth);
                
                TableSchema.TableColumn colvarChildTypeDepth = new TableSchema.TableColumn(schema);
                colvarChildTypeDepth.ColumnName = "ChildTypeDepth";
                colvarChildTypeDepth.DataType = DbType.Int32;
                colvarChildTypeDepth.MaxLength = 0;
                colvarChildTypeDepth.AutoIncrement = false;
                colvarChildTypeDepth.IsNullable = false;
                colvarChildTypeDepth.IsPrimaryKey = false;
                colvarChildTypeDepth.IsForeignKey = false;
                colvarChildTypeDepth.IsReadOnly = false;
                
                schema.Columns.Add(colvarChildTypeDepth);
                
                TableSchema.TableColumn colvarChildTypePath = new TableSchema.TableColumn(schema);
                colvarChildTypePath.ColumnName = "ChildTypePath";
                colvarChildTypePath.DataType = DbType.AnsiString;
                colvarChildTypePath.MaxLength = 500;
                colvarChildTypePath.AutoIncrement = false;
                colvarChildTypePath.IsNullable = false;
                colvarChildTypePath.IsPrimaryKey = false;
                colvarChildTypePath.IsForeignKey = false;
                colvarChildTypePath.IsReadOnly = false;
                
                schema.Columns.Add(colvarChildTypePath);
                
                
                BaseSchema = schema;
                //add this schema to the provider
                //so we can query it later
                DataService.Providers["MedianamikProvider"].AddSchema("vw_medianamik_HierarchicalRuleFull",schema);
            }
        }
        #endregion
        
        #region Query Accessor
	    public static Query CreateQuery()
	    {
		    return new Query(Schema);
	    }
	    #endregion
	    
	    #region .ctors
	    public HierarchicalRuleFull()
	    {
            SetSQLProps();
            SetDefaults();
            MarkNew();
        }
        public HierarchicalRuleFull(bool useDatabaseDefaults)
	    {
		    SetSQLProps();
		    if(useDatabaseDefaults)
		    {
				ForceDefaults();
			}
			MarkNew();
	    }
	    
	    public HierarchicalRuleFull(object keyID)
	    {
		    SetSQLProps();
		    LoadByKey(keyID);
	    }
    	 
	    public HierarchicalRuleFull(string columnName, object columnValue)
        {
            SetSQLProps();
            LoadByParam(columnName,columnValue);
        }
        
	    #endregion
	    
	    #region Props
	    
          
        [XmlAttribute("HierarchicalRuleId")]
        [Bindable(true)]
        public Guid HierarchicalRuleId 
	    {
		    get
		    {
			    return GetColumnValue<Guid>("HierarchicalRuleId");
		    }
            set 
		    {
			    SetColumnValue("HierarchicalRuleId", value);
            }
        }
	      
        [XmlAttribute("ChildTypeId")]
        [Bindable(true)]
        public Guid ChildTypeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid>("ChildTypeId");
		    }
            set 
		    {
			    SetColumnValue("ChildTypeId", value);
            }
        }
	      
        [XmlAttribute("ParentTypeId")]
        [Bindable(true)]
        public Guid ParentTypeId 
	    {
		    get
		    {
			    return GetColumnValue<Guid>("ParentTypeId");
		    }
            set 
		    {
			    SetColumnValue("ParentTypeId", value);
            }
        }
	      
        [XmlAttribute("ChildTypeName")]
        [Bindable(true)]
        public string ChildTypeName 
	    {
		    get
		    {
			    return GetColumnValue<string>("ChildTypeName");
		    }
            set 
		    {
			    SetColumnValue("ChildTypeName", value);
            }
        }
	      
        [XmlAttribute("ParentTypeName")]
        [Bindable(true)]
        public string ParentTypeName 
	    {
		    get
		    {
			    return GetColumnValue<string>("ParentTypeName");
		    }
            set 
		    {
			    SetColumnValue("ParentTypeName", value);
            }
        }
	      
        [XmlAttribute("ParentTypeCanHaveChilds")]
        [Bindable(true)]
        public bool? ParentTypeCanHaveChilds 
	    {
		    get
		    {
			    return GetColumnValue<bool?>("ParentTypeCanHaveChilds");
		    }
            set 
		    {
			    SetColumnValue("ParentTypeCanHaveChilds", value);
            }
        }
	      
        [XmlAttribute("ParentTypeIsGenerated")]
        [Bindable(true)]
        public bool? ParentTypeIsGenerated 
	    {
		    get
		    {
			    return GetColumnValue<bool?>("ParentTypeIsGenerated");
		    }
            set 
		    {
			    SetColumnValue("ParentTypeIsGenerated", value);
            }
        }
	      
        [XmlAttribute("ChildTypeCanHaveChilds")]
        [Bindable(true)]
        public bool ChildTypeCanHaveChilds 
	    {
		    get
		    {
			    return GetColumnValue<bool>("ChildTypeCanHaveChilds");
		    }
            set 
		    {
			    SetColumnValue("ChildTypeCanHaveChilds", value);
            }
        }
	      
        [XmlAttribute("ChildTypeIsGenerated")]
        [Bindable(true)]
        public bool ChildTypeIsGenerated 
	    {
		    get
		    {
			    return GetColumnValue<bool>("ChildTypeIsGenerated");
		    }
            set 
		    {
			    SetColumnValue("ChildTypeIsGenerated", value);
            }
        }
	      
        [XmlAttribute("ParentTypePath")]
        [Bindable(true)]
        public string ParentTypePath 
	    {
		    get
		    {
			    return GetColumnValue<string>("ParentTypePath");
		    }
            set 
		    {
			    SetColumnValue("ParentTypePath", value);
            }
        }
	      
        [XmlAttribute("ParentTypeDepth")]
        [Bindable(true)]
        public int? ParentTypeDepth 
	    {
		    get
		    {
			    return GetColumnValue<int?>("ParentTypeDepth");
		    }
            set 
		    {
			    SetColumnValue("ParentTypeDepth", value);
            }
        }
	      
        [XmlAttribute("ChildTypeDepth")]
        [Bindable(true)]
        public int ChildTypeDepth 
	    {
		    get
		    {
			    return GetColumnValue<int>("ChildTypeDepth");
		    }
            set 
		    {
			    SetColumnValue("ChildTypeDepth", value);
            }
        }
	      
        [XmlAttribute("ChildTypePath")]
        [Bindable(true)]
        public string ChildTypePath 
	    {
		    get
		    {
			    return GetColumnValue<string>("ChildTypePath");
		    }
            set 
		    {
			    SetColumnValue("ChildTypePath", value);
            }
        }
	    
	    #endregion
    
	    #region Columns Struct
	    public struct Columns
	    {
		    
		    
            public static string HierarchicalRuleId = @"HierarchicalRuleId";
            
            public static string ChildTypeId = @"ChildTypeId";
            
            public static string ParentTypeId = @"ParentTypeId";
            
            public static string ChildTypeName = @"ChildTypeName";
            
            public static string ParentTypeName = @"ParentTypeName";
            
            public static string ParentTypeCanHaveChilds = @"ParentTypeCanHaveChilds";
            
            public static string ParentTypeIsGenerated = @"ParentTypeIsGenerated";
            
            public static string ChildTypeCanHaveChilds = @"ChildTypeCanHaveChilds";
            
            public static string ChildTypeIsGenerated = @"ChildTypeIsGenerated";
            
            public static string ParentTypePath = @"ParentTypePath";
            
            public static string ParentTypeDepth = @"ParentTypeDepth";
            
            public static string ChildTypeDepth = @"ChildTypeDepth";
            
            public static string ChildTypePath = @"ChildTypePath";
            
	    }
	    #endregion
	    
	    
	    #region IAbstractRecord Members
        public new CT GetColumnValue<CT>(string columnName) {
            return base.GetColumnValue<CT>(columnName);
        }
        public object GetColumnValue(string columnName) {
            return base.GetColumnValue<object>(columnName);
        }
        #endregion
	    
    }
}
